package com.pureut.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.pureut.common.security.utils.SecurityUtils;
import com.pureut.system.domain.QualityAssessment;
import com.pureut.system.domain.vo.QualityAssessmentVo;
import com.pureut.system.mapper.QualityAssessmentMapper;
import com.pureut.system.service.IQualityAssessmentService;
import org.springframework.stereotype.Service;
import java.util.Date;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;

/**
 * @Author: pureut
 * @Date: 2025-04-08 16:15:48
 * @Desc: 质量考核单管理表
 */
@Service("qualityAssessmentService")
public class QualityAssessmentServiceImpl extends ServiceImpl<QualityAssessmentMapper, QualityAssessment> implements IQualityAssessmentService {

    /**
     * 质量考核单管理表Dao
     */
    @Resource
    private QualityAssessmentMapper qualityAssessmentMapper;




    /**
     * 新增质量考核单管理表
     * @param qualityAssessmentVo
     * @return
     */
    @Override
    public Boolean save(QualityAssessmentVo qualityAssessmentVo) {
        QualityAssessment qualityAssessment = new QualityAssessment();
        BeanUtil.copyProperties(qualityAssessmentVo, qualityAssessment);
        qualityAssessment.setCreateBy(SecurityUtils.getUsername());
        qualityAssessment.setCreateTime(new Date());
        qualityAssessment.setStatus("1");
        return save(qualityAssessment);
    }


    /**
     * 更新质量考核单管理表
     * @param qualityAssessmentVo
     * @return
     */
    @Override
    public Boolean updateById(QualityAssessmentVo qualityAssessmentVo) {
        QualityAssessment qualityAssessment = new QualityAssessment();
        BeanUtil.copyProperties(qualityAssessmentVo, qualityAssessment);
        qualityAssessment.setUpdateBy(SecurityUtils.getUsername());
        qualityAssessment.setUpdateTime(new Date());
        return updateById(qualityAssessment);
    }
}
